function getQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r!=null) return decodeURI(r[2]);
    return "";
}
var index=getQueryString("index");
$("#nav ul li:eq("+index+")").css("background","#882169");
var userInfo =sessionStorage.getItem("userInfo");
userInfo=JSON.parse(userInfo);
if(userInfo!=null){
    $("#loginState").html(' 欢迎'+userInfo.stuName+'同学 <span id="exitBtn" onclick="exitLogin()">退出登录</span>').show();
}
function exitLogin() {
    $.post("/student/exitLogin",function () {
        parent.location.reload();
        sessionStorage.removeItem("userInfo")
    });
}